<template>
	<view style="padding-top: 140rpx;">
		<view class="pjBox">
			<image :src="$util.img(promoter.avatar)" mode=""></image>
			<view class="font-30 font-weight textC">{{promoter.realname||''}}</view>
			<view class="font-32 font-weight textC m-t-40">评价推广师给你的整体感觉？</view>
			<view class="textC" style="margin: 40rpx auto;display: flex;justify-content: center;">
				<uv-rate v-model="score" size="50" activeColor="#e5632b"></uv-rate>
			</view>
			<view class="textareaBox">
				<textarea name="text" id="1" maxlength="100" cols="30" rows="10" v-model="evValue"></textarea>
				<view class="abBox">{{evValue.length}}/100</view>
			</view>
		</view>
		
		<view class="bomPosition">
			<button @click="submit">提交评价</button>
			<view class="h-10"></view>
		</view>
		<uv-toast ref="uToast"></uv-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				score:5,
				evValue:'',
				promoter:{},
				promoter_id:''
			};
		},
		onLoad(res) {
			this.promoter_id = res.id
			this.getPromoterDetali(res.id)
		},
		methods:{
			submit() {
				this.$api.sendRequest({
					url:'/api/user/evaluate',
					data:{
						score:this.score,
						promoter_id:this.promoter_id,
						content:this.evValue
					},success:res=>{
						this.$refs.uToast.show({
							type: 'default',
							message: res.msg,
							duration:2000
						})
						if(res.code==1) {
							setTimeout(()=>{
								uni.navigateBack()
							},2000)
						}
					}
				})
			},
			getPromoterDetali(id) {
				this.$api.sendRequest({
					url:'/api/promoter/detail',
					data:{
						id:id
					},success:res=>{
						this.promoter = res.data
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f5f6f7;
	}
	.pjBox {
		
		padding: 100rpx 0;
		width: 690rpx;
		height: 636rpx;
		opacity: 1;
		border-radius: 	48rpx 48rpx 0rpx 0rpx;
		background: rgba(255, 255, 255, 1);
		margin: 0 auto;
		position: relative;
		
		image {
			width: 128rpx;
			height: 128rpx;
			border-radius: 60%;
			position: absolute;
			top: -64rpx;
			left: 50%;
			margin-left: -64rpx;
		}
		.textareaBox {
			width: 642rpx;
			height: 356rpx;
			position: relative;
			margin: 0 auto;
			.abBox {
				position: absolute;
				right: 10rpx;
				bottom: 10rpx;
			}
			textarea {
				width: 602rpx;
				height: 316rpx;
				opacity: 1;
				border: 2rpx solid rgba(229, 233, 239, 1);
				margin: 0 auto;
				padding: 20rpx;
			}
		}
		
	}
</style>
